package com.maybach.core.dal.mapper.ext;

import com.maybach.common.dto.UserInfoDTO;
import com.maybach.common.query.ext.UserListQuery;
import com.maybach.core.dal.mapper.UserMapper;
import com.maybach.core.form.user.UserUpdateStatusForm;

import java.sql.SQLException;
import java.util.List;

/**
 * MyBatis Ext Mapper for User.
 */
public interface UserExtMapper extends UserMapper {

    /**
     * 根据查询条件获取用户信息列表
     * @param query
     * @return
     * @throws SQLException
     */
    List<UserInfoDTO> queryUsersByQueryDao(UserListQuery query) throws SQLException;

    /**
     * 根据查询条件获取用户数量
     * @param query
     * @return
     * @throws SQLException
     */
    Integer countUsersByQueryDao(UserListQuery query) throws SQLException;

    /**
     * 修改用户状态(包括逻辑删除)
     * @param form
     * @return
     * @throws SQLException
     */
    int updateUserStatusByFormDao(UserUpdateStatusForm form) throws SQLException;

    /**
     * 根据用户ID获取商家id
     * @param userId
     * @return
     * @throws SQLException
     */
    Long queryPartnerIdByUserIdDao(Long userId) throws SQLException;

    /**
     * 查询是否存在用户
     * @param userId
     * @return
     * @throws SQLException
     */
    int countUserByUserId(Long userId) throws SQLException;

}